﻿



CREATE PROCEDURE [dbo].[proc_Company_GetList]
	/*
	(
	@parameter1 int = 5,
	@parameter2 datatype OUTPUT
	)
	*/
AS
	Select 
		Id, CompanyName,Startletter,CompanyNumber,CompanyPhone,CompanyFax,CompanyAddress,Zip,ContactPerson,ContactPhone,ContactEmail,WebAddress,Products,
		CompanyAllName,dwbh,
		isnull((Select M.CompanyName From ManagementArea M Where M.Id=Company.Mid),'...') as ManagementAreaName
--	 From Company Order by CompanyNumber
From Company Order by (Select M.CompanyNumber From ManagementArea M Where M.Id=Company.Mid) ASC,CompanyNumber
	RETURN




